#pragma once
#include "DDefine.h"
//////////////////////////////////////////////////////////////////////////
// Name : DInput
// Desc : Input
// Date : [3/21/2012]
//////////////////////////////////////////////////////////////////////////
class DInput : public DSingleton <DInput>
{
private:
	// Member Data 	
	enum KEY_FLAG_STATE
	{
		KEY_UP			= 0x01
		,KEY_FIRSTUP	= 0x02
		,KEY_OFF		= 0x03
		,KEY_DWON		= 0x04
		,KEY_FIRSTDOWN	= 0x08
		,KEY_ON			= 0x0C
		,KEY_CHECK		= 0x80
	};

	HWND	m_hWnd;
	BYTE	m_KeyState[256];
	BYTE	m_FixedKeyState[256];
	POINT	m_CursorPos;
	POINT	m_PreCursorPos;
	POINT	m_CursorMov;
	short	m_Wheel;
	

private:
	friend class DSingleton <DInput>;
	DInput();
	~DInput();

public:
	// Member Method
	bool	Init(HWND hWnd);
	bool	Frame();
	bool	Release();
	void	Clear();

	bool	IsKeyDown(int vKey)			const	{	return ((m_FixedKeyState[vKey] & KEY_DWON)		!= 0) ? true : false;	}
	bool	IsKeyUp(int vKey)			const	{	return ((m_FixedKeyState[vKey] & KEY_UP)		!= 0) ? true : false;	}
	bool	IsKeyDownFirst(int vKey)	const	{	return ((m_FixedKeyState[vKey] & KEY_FIRSTDOWN) != 0) ? true : false;	}
	bool	IsKeyUpFirst(int vKey)		const	{	return ((m_FixedKeyState[vKey] & KEY_FIRSTUP)	!= 0) ? true : false;	}

	POINT	GetCursorPos()				const	{	return m_CursorPos;		}
	int		GetCursorX()				const	{	return m_CursorPos.x;	}
	int		GetCursorY()				const	{	return m_CursorPos.y;	}

	POINT	GetCursorMove()				const	{	return m_CursorMov;		}
	int		GetCursorMoveX()			const	{	return m_CursorMov.x;	}
	int		GetCursorMoveY()			const	{	return m_CursorMov.y;	}

	short	GetWheel()					const	{	return m_Wheel;			}
	void	SetWheel(short Wheel)				{	m_Wheel = Wheel;		}
	void	ResetWheel()						{	m_Wheel = 0;			}


};